class Base():
    __a = "Base"

    def __init__(self):
        self.__abc = 1
        self.abc = 123

    @classmethod
    def display(cls):
        print(cls.__a)


class Derived(Base):
    __a = "Derived"  # 私有的类变量，子类失效


class Derived2(Derived):
    __a = "Derived2"


print(dir(Base))  # ['_Base__a', ..., 'display']

b = Base()
print(dir(b))  # ['_Base__a', '_Base__abc', ..., 'abc', 'display']

Base.display()  # Base
Derived.display()  # Base
Derived2.display()  # Base


class A():
    __abc = 1


b = A()
b.__abc = 3
print(b.__abc)  # 3
# print(A.__abc)  # AttributeError: type object 'A' has no attribute '__abc'
